package com.nengchuan.kbms.dfs.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nengchuan.kbms.common.PageServiceImpl;
import com.nengchuan.kbms.dfs.annotation.UserOperateLogger;
import com.nengchuan.kbms.dfs.dao.UserOperateHistoryMapper;
import com.nengchuan.kbms.dfs.entity.dto.UserOperateCreateListDTO;
import com.nengchuan.kbms.dfs.entity.dto.UserOperateCreatePageDTO;
import com.nengchuan.kbms.dfs.entity.dto.UserOperateDownloadListDTO;
import com.nengchuan.kbms.dfs.entity.dto.UserOperateDownloadPageDTO;
import com.nengchuan.kbms.dfs.entity.po.UserOperateHistory;
import com.nengchuan.kbms.dfs.entity.vo.OperateTopVO;
import com.nengchuan.kbms.dfs.entity.vo.UserOperateCreateVO;
import com.nengchuan.kbms.dfs.entity.vo.UserOperateDownloadVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 * 用户操作历史 服务实现类
 * </p>
 *
 * @author abe
 * @since 2020-04-01
 */
@Service
public class UserOperateHistoryServiceImpl extends PageServiceImpl<UserOperateHistoryMapper, UserOperateHistory> implements UserOperateHistoryService {

    @Autowired
    private UserOperateHistoryMapper userOperateHistoryMapper;

    /**
     * 操作排行
     */
    @Override
    public List<OperateTopVO> operateTop(UserOperateLogger.Type type) {
        Objects.requireNonNull(type);
        return userOperateHistoryMapper.operateTop(type.value);
    }

    /**
     * 我的创建（分页
     */
    @Override
    public IPage<UserOperateCreateVO> createPage(UserOperateCreatePageDTO pageDTO) {
        return userOperateHistoryMapper.createPage(pageDTO);
    }

    /**
     * 我的导出（分页
     */
    @Override
    public IPage<UserOperateDownloadVO> downloadPage(UserOperateDownloadPageDTO pageDTO) {
        return userOperateHistoryMapper.downloadPage(pageDTO);
    }

    /**
     * 我的创建列表
     */
    @Override
    public List<UserOperateCreateVO> createList(UserOperateCreateListDTO listDTO) {
        return userOperateHistoryMapper.createList(listDTO);
    }

    /**
     * 我的导出列表
     */
    @Override
    public List<UserOperateDownloadVO> downloadList(UserOperateDownloadListDTO listDTO) {
        return userOperateHistoryMapper.downloadList(listDTO);
    }

}
